<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    errorPage=""
    %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>新增會員</title>
    <script language="JavaScript">
  function formCheck()
  {
     if(document.myForm.id.value == ""){
	      alert("請輸入帳號");
		  document.myForm.id.focus()
		  return false;
	 }
	 	 
	 if(document.myForm.name.value == ""){
	      alert("請輸入姓名");
		  document.myForm.name.focus()
		  return false;
	 }
	  if(document.myForm.sex.value == ""){
	      alert("請輸入性別");
		  document.myForm.sex.focus()
		  return false;
	 }
	  if(document.myForm.phone.value == ""){
	      alert("請輸入電話");
		  document.myForm.phone.focus()
		  return false;
	 }
	  if(document.myForm.address.value == ""){
	      alert("請輸入地址");
		  document.myForm.address.focus()
		  return false;
	 }
	 if(document.myForm.email.value == ""){
	      alert("請輸入電子郵件");
		  document.myForm.email.focus()
		  return false;
	 }
	 if (document.myForm.email.value.indexOf("@")=="-1"){
         alert("e-mail格式錯誤")
         document.myForm.email.focus()
         return false
         }
     else if (document.myForm.email.value.indexOf(".")=="-1"){
	     alert("e-mail格式錯誤")
         document.myForm.email.focus()
         return false
         }
	  if(document.myForm.dep.value == ""){
	      alert("請輸入部門");
		  document.myForm.dep.focus()
		  return false;
	 }
	  if(document.myForm.por_name.value == ""){
	      alert("請輸入職稱");
		  document.myForm.por_name.focus()
		  return false;
	 }
	  
	  if(document.myForm.level_id.value == ""){
	      alert("請輸入權限");
		  document.myForm.level_id.focus()
		  return false;
	 }
  }
</script>
    </head>
  <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
 
<% if(session.getAttribute("access") == "y" ){%>
 <table width="750" border="0" align="center">
  <tr>
    <td width="30" rowspan="4"><jsp:include page="../frameset/left.jsp" flush="true" ></jsp:include></td>
    <td colspan="2"><jsp:include page="../frameset/top.jsp" flush="true" ></jsp:include></td>
    <td width="40" rowspan="4"><jsp:include page="../frameset/right.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td rowspan="2"><jsp:include page="../frameset/mean.jsp" flush="true" ></jsp:include>

    </td>
    <td height="32"><jsp:include page="../frameset/member_mean.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td>
    <table width="500" cellspacing="0" cellpadding="0"> 
 <tr>
    <td align="center" valign="top" bordercolor="1">
      <div align="center">  
        <table width="100%"  border="0" cellspacing="1" cellpadding="1">
          <tr>
            <td align="center" valign="top" bordercolor="#00CCFF"><div align="center">
            <form name="myForm" method="post" action="do_addmember.jsp">    <%//送出表單 %>
              <table width="100%"  border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#999999">
                <tr bgcolor="#FFFFCC">
                  <td width="23%"><div align="right"><span class="gytext11"><font class=cherry></font>帳號：</span></div></td>
                  <td width="77%"><div align="left"><span class="lggytext11">
                      <input type=text maxlength=50 value="" name="id">
                    請輸入員工編號 </span></div></td>
                </tr>
                
                <tr>
                  <td><div align="right"><span class="gytext11"><font class=cherry></font>姓名：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                      <input maxlength=50 name=name>
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td><div align="right"><span class="gytext11">性別：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                      <input id=Sex type=radio checked value="M" name=sex>
                      <label for=Sex0>男</label>
                      <input id=Sex type=radio value="F" name=sex>
                      <label for=Sex1>女</label>
                  </span></div></td>
                </tr>
                <tr>
                  <td><div align="right"><span class="gytext11">聯絡電話：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                      <input maxlength=15 size=25 name=phone>
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td><div align="right"><span class="gytext11">聯絡地址：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                    <input maxlength=50 size=48 name=address>
                  </span></div></td>
                </tr>
                <tr>
                  <td><div align="right">E-mail：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <input maxlength=40 size=48 name=email>
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td><div align="right">部門：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <select size=1 name="dep">
                      <option value=0 selected>請選擇
                        <option value="業務">業務
                          <option value="行銷">行銷
                          <option value="資訊">資訊
                          <option value="會計">會計
                          <option value="人事">人事
                          <option value="生產">生產 </option>
                    </select>
                  </span></div></td>
                </tr>
                <tr>
                  <td><div align="right">職稱：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <select size=1 name="por_name">
                      <option value=0 selected>請選擇
                        <option value="職員">職員
                          <option value="經理">經理
                          <option value="總經理">總經理 </option>
                    </select>
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td><div align="right">權限：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <select size=1 name="level_id">
                      <option value=0 selected>請選擇
                        <option value=1>會員
                          <option value=2>管理者 </option>
                    </select>
                  </span></div></td>
                </tr>
            
                <tr>
                  <td colspan="2"><div align="right">
                      <input type="hidden" name="textfield"/>
                      <input name="Submit" type="submit"  onClick="return formCheck()" value="新增" /> 
                  </div></td>
                </tr>
              </table>
            
                </form>
              </div>            </td>
          </tr>
        </table>  
</div>      </td>
</table>
    </td>
  </tr>
  <tr>
    <td colspan="2"></td>
  </tr>
</table> 
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>  
</body>
</html>